home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / bitstrg.zip / LCLBITAR.C < prev    next >
C/C++ Source or Header  |  1989-06-05  |  623b  |  33 lines

  1. /*
  2.     librairie : bitstrg
  3.  
  4.     lclrbitarray --    initialisation a 0 d'un champ de bits
  5.  
  6.  
  7.                 Le parametre nombre de bits est de type unsigned long
  8.  
  9.     Attention : en Small Memory Model le champ Data est limite a 64Koctets
  10. */
  11.  
  12.  
  13. #include "bitstrg.h"
  14.  
  15. /*
  16.     Clear bit array to all 0s
  17. */
  18.  
  19. void lclrbitarray(ptr)
  20.     struct LSPARRAY * ptr;        /* pointer on structure */
  21. {
  22.  
  23.     unsigned    ind;
  24.  
  25.     ELEBAR*        ptrbit;
  26.  
  27.     ind = (((long)ptr->numlbit + 1) / SIZE)
  28.              + ((((long)ptr->numlbit + 1) & (SIZE - 1)) ? 1 : 0);
  29.      for (ptrbit = ptr -> pntarray ;ind > 0;--ind,++ptrbit) {
  30.         *ptrbit ^= *ptrbit;        /* exclusive-OR */
  31.     }
  32. }
  33.